package com.canin.interceptor;

import java.util.Map;

import com.canin.Constant;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class LoginInterceptor extends AbstractInterceptor {

	private static final long serialVersionUID = -731718066341836798L;

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		
		Map<String, Object> session = invocation.getInvocationContext().getSession();
		
		if( session.get(Constant.ADMIN) == null )
		{
			return "loginRedirect"; //test
		}
		
		return invocation.invoke();
	}

}
